import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class TodoService {
  todoLists: any[] = [];

  constructor() { }

  addTodo(data: any) {
    this.todoLists.push(data)
  }

  getTodo(id: number) {
    return this.todoLists.find(item => item.id === id)
  }

  delTodo(id: number) {
    this.todoLists = this.todoLists.filter(item => id !== item.time)
  }
}
